<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <title>后台管理系统</title>
    <meta name="author" content="DeathGhost"/>
    <link rel="stylesheet" type="text/css" href="/admin/css/style.css">
    <!--[if lt IE 9]>
    <script src="/admin/js/html5.js"></script>
    <![endif]-->
    <script src="/admin/js/jquery.js"></script>
    <script src="/admin/js/jquery.mCustomScrollbar.concat.min.js"></script>
    <script>
        (function ($) {
            $(window).load(function () {

                $("a[rel='load-content']").click(function (e) {
                    e.preventDefault();
                    var url = $(this).attr("href");
                    $.get(url, function (data) {
                        $(".content .mCSB_container").append(data); //load new content inside .mCSB_container
                        //scroll-to appended content 
                        $(".content").mCustomScrollbar("scrollTo", "h2:last");
                    });
                });

                $(".content").delegate("a[href='top']", "click", function (e) {
                    e.preventDefault();
                    $(".content").mCustomScrollbar("scrollTo", $(this).attr("href"));
                });

            });
        })(jQuery);
    </script>
</head>

<body>
<!--header-->
<header>
    <div th:replace="admin/topBar::heater"></div>
</header>
<!--aside nav 开始-->

<aside class="lt_aside_nav content mCustomScrollbar">
    <div th:replace="admin/leftBar::left"></div>
</aside>
<!--aside nav结束-->
<section class="rt_wrap content mCustomScrollbar">
    <div class="rt_content">
        <div class="page_title">
            <h2 class="fl">订单列表示例</h2>
            <a class="fr top_rt_btn add_icon">添加商品</a>
        </div>

        <section class="mtb">
            <form action="/Orders/State" method="post">
                <label>
                    <select name="orderState" class="select">
                        <option value="0">订单状态</option>
                        <option th:selected="${state == 1}" value="1">未发货</option>
                        <option th:selected="${state == 2}" value="2">已发货</option>
                        <option th:selected="${state == 3}" value="3">已接收</option>
                        <option th:selected="${state == 4}" value="4">取消订单申请中</option>
                        <option th:selected="${state == 5}" value="5">已取消</option>
                        <option th:selected="${state == 6}" value="6">取消失败</option>
                    </select>
                </label>
                <input type="submit" value="查询" class="group_btn"/>
            </form>
        </section>
        <table class="table">
            <tr>
                <th>订单编号</th>
                <th>生成时间</th>
                <th>当前状态</th>
                <th>完成时间</th>
                <th>订单总额</th>
                <th>下单用户</th>
                <th>购买商品</th>
                <th>操作</th>
            </tr>
            <tr th:each="allorder : ${allOrder}">
                <td th:text="${allorder.order.orderId}" class="center">1</td>
                <td th:text="${#dates.format(allorder.order.orderStart, 'yyyy-MM-dd HH:mm:ss')}">20210622103852</td>
                <td th:text="${allorder.order.orderState.orderState}">已发货</td>
                <td th:text="${allorder.order.orderEnd == 0?'':#dates.format(allorder.order.orderEnd, 'yyyy-MM-dd HH:mm:ss')}">
                    20210622104003
                </td>
                <td class="center"><strong th:text="${allorder.order.orderShopTotal}" class="rmb_icon">59.00</strong>
                </td>
                <td th:text="${allorder.order.orderUserAccount}" class="center">123456</td>
                <td th:text="${allorder.goods.goodsName}" class="center">123456</td>
                <td class="center">
                    <a th:if="${allorder.order.orderState.orderStateId == 1}" th:href="@{/Orders/Update(orderId=${allorder.order.orderId},orderState=2)}" title="商品发货"
                       class="link_icon" target="_blank">&#118;</a>
                    <a th:if="${allorder.order.orderState.orderStateId == 4}" th:href="@{/Orders/Update(orderId=${allorder.order.orderId},orderState=5)}" title="同意申请" class="link_icon">&#100;</a>
                    <a th:if="${allorder.order.orderState.orderStateId == 4}" th:href="@{/Orders/Update(orderId=${allorder.order.orderId},orderState=6)}" title="驳回申请" class="link_icon">&#100;</a>
                </td>
            </tr>
        </table>
    </div>
</section>
</body>

</html>